#ifndef WINDOW
#define WINDOW

#include <QComboBox>
#include <QVBoxLayout>
#include <QLabel>
#include <QPushButton>
#include <QLineEdit>
#include <QFileInfo>
#include <QWaitCondition>
#include <QMutex>
#include <QSemaphore>
#include <QGroupBox>
#include <map>
#include "restrictionlayout.hpp"
#include "findduplicates.hpp"
#include "mytree.h"


class Window:public QWidget {
	Q_OBJECT

	public:
		Window();
		~Window();
	private slots:
		void browse();
		void findDuplicates();
		void addRestriction();
		void rmRestriction(int);
		void threadFinished();
		void addDuplicates(QList<QFileInfo *> *);
		void rmDuplicates();
	private:
		std::map<QList<QFileInfo *> *,QTreeWidgetItem *> groups;
		QTreeWidget *qtw;
		FindDuplicates *t;
		FilesList *files;
		RestrictionLayout* rest[4];
		QVBoxLayout *qvblrestrictions;
		QLabel *qllocation,*qltype;
		QGroupBox *gbhorizontal;
		QPushButton *qpbbrowse,*qpbstart,*qpbstop,*qpbaddrestriction;
		QLineEdit *qlelocation;
		QComboBox *qcbtype,*qcbrestriction;
		void makeConnections();
		bool validate();
		QString validateRestrictions();
		QString validateLocation();
		QWaitCondition *wc;
		QMutex *mut_ui,*mut_fl;
		QSemaphore *sem;
		QDateTime time;
};

#endif
